<template>
  <div class="app-container">

    <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
      <el-form-item label="姓名" prop="patName">
        <el-input
            v-model="queryParams.patName"
            placeholder="姓名"
            clearable
            style="width: 200px"
            @keyup.enter="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
        <el-button type="primary" v-if="false" icon="Plus" @click="handleAdd" v-hasPermi="['by:post:add']">添加
        </el-button>
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="postList">
      <el-table-column  align="center" prop="patName"/>
      <el-table-column  align="center" prop="msgType"/>
      <el-table-column  align="center" prop="msgSender"/>
      <el-table-column  align="center" prop="msgorgsn"/>
      <el-table-column  align="center" prop="msgTime"/>
      <el-table-column  align="center" prop="msgRspcode"/>
      <el-table-column  align="center" prop="msgRspdesc"/>
      <el-table-column  align="center" prop="msgSign"/>
      <el-table-column  align="center" prop="returnTime"/>
      <el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
        <template #default="scope">
           <el-button link type="primary" @click="handleDetail(scope.row)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-dialog title="报文" v-model="open" width="700px" append-to-body>
      <el-form :model="formDetail" label-width="100px">
        <el-form-item prop="representor">
          {{ formDetail.rucan }}
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="closeDetailDialog()">关 闭</el-button>
        </div>
      </template>
    </el-dialog>

    <pagination
        v-show="total > 0"
        :total="total"
        v-model:page="queryParams.pageNum"
        v-model:limit="queryParams.pageSize"
        @pagination="getList"
    />
  </div>
</template>

<script setup>
import { getPostLog } from "@/api/hospital/ActPatList";
import { updateOutPatList } from "@/api/hospital/MrOutData";
const {proxy} = getCurrentInstance();
const {sys_normal_disable} = proxy.useDict("sys_normal_disable");
const { sys_user_sex, sys_card_type, sys_country, sys_nation, sys_occupation, sys_marriage, sys_in_hospital } = proxy.useDict("sys_user_sex", "sys_card_type", "sys_country", "sys_nation", "sys_occupation", "sys_marriage", "sys_in_hospital");
const { sys_region, sys_guanxi, sys_payment } = proxy.useDict("sys_region", "sys_guanxi", "sys_payment");
const { sys_diag_type, sys_yes_no } = proxy.useDict("sys_diag_type","sys_yes_no");
const { sys_abo, sys_rh, sys_consultation_subject, sys_outway, sys_mrout } = proxy.useDict("sys_abo", "sys_rh", "sys_consultation_subject","sys_outway","sys_mrout");

const total = ref(0);
const showSearch = ref(true);
const postList = ref([]);
const open = ref(false);
const title = ref("");
const loading = ref(true);
const ids = ref([]);
const imageUrl = ref('');
const subjectlist = ref([]);
const schoollist = ref([]);
const fdlist = ref([]);
const timeList = ref([]);
const formDetail = ref();
const open_cl = ref(false);
const data = reactive({
  form: {},
  mrOutRecord:{},
  queryParams: {
    pageNum: 1,
    pageSize: 100,
    patName: undefined
  },
  rules: {}
});
const { queryParams, form, rules, mrOutRecord } = toRefs(data);

function handleQuery() {
  queryParams.value.pageNum = 1;
  getList();
}


function getList() {
  loading.value = true;
  getPostLog(queryParams.value).then(response => {
    console.log(response)
    postList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}

function handleDetail(row){
  formDetail.value = row;
  open.value = true;
}


function closeDetailDialog(){
  open.value = false;
  formDetail.value = null;
}


function handleDetailUpdate(){
  updateOutPatList(formDetail.value).then(response =>{
    proxy.$modal.msgSuccess(response.msg);
  })
}

getList();
</script>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed var(--el-border-color);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--el-transition-duration-fast);
}

.avatar-uploader .el-upload:hover {
  border-color: var(--el-color-primary);
}

.el-icon.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 100px;
  height: 100px;
  text-align: center;
}

.avatar{
  width: 100px;
  height: 100px;
}
.a4-paper {
  width: 794px; /* A4纸张宽度 */
  /*height: 1123px; !* A4纸张高度 *!*/
  margin: auto; /* 水平居中 */
  background-color: rgba(255, 255, 255, 0.06); /* 背景色，可根据需要调整 */
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); /* 可选，添加一些阴影效果 */
  padding: 20px; /* 内边距，根据需要调整 */
  /* 如果需要模拟打印页面的边距，可以进一步设置 */
  position: relative; /* 如果需要定位内部元素 */
  font-size: 6px;
}
.shuru {
  width: 50px;
  font-size: 5px;
  border: none;
  border-bottom: 1px solid #ccc;
}
</style>

